/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cassys.ejb.sessionbean;

import cassys.dataaccess.DAOException;
import cassys.dataaccess.DAOFactory;
import cassys.dataaccess.LectureDAO;
import cassys.dataaccess.ModuleDAO;
import cassys.dataaccess.UserDAO;
import cassys.datatransferobjects.LecturerDTO;
import cassys.datatransferobjects.ModuleDTO;
import java.util.ArrayList;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;

/**
 *
 * @author ASUS
 */
@Stateless(mappedName="LecturerBean") 
public class LecturerBean implements LecturerBeanRemote{

    private LectureDAO lecturerDAO = null;
    private UserDAO userDAO=null;
    public LecturerBean(){
    }
    
    public void ejbCreate() {
       
        lecturerDAO = DAOFactory.getInstance().getLecturerDAO();
        userDAO = DAOFactory.getInstance().getUserDAO();
    }

    @Override
    public ArrayList<LecturerDTO> findAllLecturers() throws DAOException {
       return lecturerDAO.findAllLecture();
    }

    @Override
    public LecturerDTO findLecturer(String userId) throws DAOException {
        return lecturerDAO.findLecture(userId);
    }
    
    @Override
    public LecturerDTO findLecturerByName(String userName) throws DAOException {
        return lecturerDAO.findLectureByName(userName);
    }

    @Override
    public void updateLecturer(LecturerDTO lecturer) throws DAOException {
       lecturerDAO.insertorUpdateLecture(lecturer);
    }

  

    @Override
    public boolean lecturerValidate(String userid, String password) throws DAOException {
      return true;
    }

    @Override
    public void insertLecturer(LecturerDTO lecturer) throws DAOException {
       lecturerDAO.insertorUpdateLecture(lecturer);
    }

    @Override
    public void deleteLecturer(LecturerDTO lecturer) throws DAOException {
        lecturerDAO.deleteLecture(lecturer);
    }

    
    
   
    
}
